<template>
  <span v-if="props.showText">{{formData[prop] || ''}}</span>
  <el-input
    v-else
    v-model="formData[prop]"
    type="textarea"
    :rows="rowLine || 5"
    @change="handleChange"
    @blur="handleBlur"
  />
</template>

<script setup>
import { inject } from 'vue';

const emit = defineEmits(['change', 'blur']);
const props = defineProps({
  prop: {
    type: String,
    default: ''
  },
  showText: Boolean,
  rowLine: {
    type: Number,
    default: 5
  }
});
const formData = inject('formData');

const handleChange = () => {
  emit('change');
};

const handleBlur = () => {
  emit('blur');
};
</script>